import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        Address: "",//当前城市
        CubeLibrary: [],// 用户当前城市的立方库
        PayForm: "",//预约支付页面
        userPhoto: "",//用户头像
        updateStatus: 0,//状态更新码-个人中心
    },
    mutations: {
        setCube(state, info) {
            state.CubeLibrary = info;
        },
        setAddress(state, info) {
            state.Address = info;
        },
        setPayForm(state, form) {
            state.PayForm = form;
        },
        setUserPhoto(state, photo) {
            state.userPhoto = photo;
        },
        setUpdateStatus(state, status) {
            state.updateStatus = status;
        }
    },
    getters: {
        getCube: function (state) {
            return state.CubeLibrary;
        },
        getAddress: function (state) {
            return state.Address;
        },
        getPayForm(state) {
            return state.PayForm;
        },
        getUserPhoto(state) {
            return state.userPhoto;
        },
        getUpdateStatus(state) {
            return state.updateStatus;
        }
    }
})

export default store;